package com.cjb.cloudsystem.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * @Author chenjinbin
 * @Package IntelliJ IDEA
 * @Class SchedulingConfig
 * @Date 2023-11-10 上午12:39
 */

@Configuration
public class SchedulingConfig {
    /**
     * 线程池配置 最大线程15
     * @Author chenjinbin
     * @Value
     * @Title
     */
    @Bean
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
        taskScheduler.setPoolSize(15);
        taskScheduler.setThreadNamePrefix("scheduled-task-");
        taskScheduler.initialize();
        return taskScheduler;
    }
}
